package com.example.internetserverhttps.slice;

import com.example.internetserverhttps.ResourceTable;

import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

import ohos.aafwk.content.Operation;


public class MainAbilitySlice extends AbilitySlice {

    private final String BUNDLE_NAME = "com.example.internetserverhttps";


    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);


        initCom();
    }

    private void initCom() {
        findComponentById(ResourceTable.Id_weather_btn)
                .setClickedListener(component -> present(new WeatherPageSlice(), new Intent()));

        findComponentById(ResourceTable.Id_phone_btn)
                .setClickedListener(component -> present(new PhoneQuerySlice(), new Intent()));

    }


    private void weather() {

//         Intent intent = new Intent();
//        Operation operation = new Intent.OperationBuilder()
//                .withDeviceId("")
//                .withBundleName(BUNDLE_NAME)
//                .withAbilityName("com.example.internetserverhttps.WeatherPage")
//                .build();
//
//        intent.setOperation(operation);
//        startAbility(intent);

    }


    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
